<template>
  <div>
    <el-dialog title="收货地址" :visible.sync="show">
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="id" label="id" width="180"> </el-table-column>
        <el-table-column prop="nickname" label="名称" width="180">
        </el-table-column>
        <el-table-column prop="type" label="获取方法"> </el-table-column>
        <el-table-column prop="status" label="状态"> </el-table-column>
        <el-table-column label="结束时间">
          <template slot-scope="scope">
            <i class="el-icon-circle-check" v-if="scope.row.is_fail == 0"></i>
            <i class="el-icon-close" v-else></i>
          </template>
        </el-table-column>
        <el-table-column prop="coupon_price" label="面值"> </el-table-column>
        <el-table-column prop="use_min_price" label="最低消费">
        </el-table-column>
        <el-table-column label="开始时间" fixed="right" width="200">
          <template slot-scope="scope">
            <div>
              {{ scope.row.add_time | time }}
            </div>
          </template>
        </el-table-column>
        <el-table-column label="结束时间" fixed="right" width="200">
          <template slot-scope="scope">
            <div>
              {{ scope.row.end_time | time }}
            </div>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        background
        layout="prev, pager, next,sizes"
        :total="total"
        :current-page="page"
        :page-size="limit"
        :page-sizes="[5, 8, 10]"
        @size-change="sizeChagne"
        @current-change="pageChange"
      >
      </el-pagination>
    </el-dialog>
  </div>
</template>

<script>
import { getHistory } from "../api";
export default {
  props: ["show",'id'],
  data() {
    return {
      tableData: [],
      page: 1,
      limit: 5,
      total: 0,
      status: "",
      coupon_title: "",
      nickname: "",
    };
  },

  methods: {
    geList() {
      getHistory(this.id).then((res) => {
        if (res.data.status == 200) {
          this.total = res.data.data.count;
          this.tableData = res.data.data.list;
        }
      });
    },
  },
  watch:{
      show(){
          this.geList()
      }
  }
};
</script>
<style lang="less" scoped></style>
